package com.thor.palmmall.rest.servicebill.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.servicebill.AServiceBillFinishParam;
import com.thor.palmmall.spi.servicebill.SServiceBillFinishParam;

public class SServiceBillFinishParamConverter implements Converter<AServiceBillFinishParam, SServiceBillFinishParam>{

  public static SServiceBillFinishParamConverter getInstance() {
    if (instance == null)
      instance = new SServiceBillFinishParamConverter();
    return instance;
  }

  private static SServiceBillFinishParamConverter instance;

  private SServiceBillFinishParamConverter() {
  }

  @Override
  public SServiceBillFinishParam convert(AServiceBillFinishParam source) {
    if(source == null){
      return null;
    }
    SServiceBillFinishParam target = new SServiceBillFinishParam();
    target.setUuid(source.getUuid());
    target.setTime(source.getTime());
    target.setUser(UCN.newInstance(source.getUser()));
    return target;
  }
}
